﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using net.xBei.WebApi.Configurations;
using xBei.Redis.Extension;

namespace net.xBei.Configurations {
    /// <summary>
    /// 
    /// </summary>
    [AutoLoadConfigurations(CONFIGURATION_NAME)]
    public class JwtSettings : IAutoLoadConfigurations {
        /// <summary>
        /// 
        /// </summary>
        public const string CONFIGURATION_NAME = "JwtSettings";
        /// <summary>
        /// 在Token过期以后（豁免期之前）是否自动刷新Token
        /// </summary>
        public bool AutoRefresh { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public string TokenSecret { get; set; } = default!;
        /// <summary>
        /// Redis服务器设置（用来保存Token相关信息的Redis数据库）
        /// </summary>
        public RedisSettings? Redis { get; set; }
        /// <summary>
        /// Token服务器（如果有专门的Token服务器，可以配置此项）
        /// </summary>
        public string? TokenService { get; set; }
        /// <summary>
        /// Token过期时间（秒），默认1800秒=30分钟
        /// </summary>
        public int Expires { get; set; } = 1800;
    }
}
